<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:decorate template="/resources/template/modelo.xhtml">
        <ui:define name="centro">
            <f:view encoding="ISO-8859-1">  
                <h:form>

                    <p:panel  header="Edição de Livro: Apoios" style="margin-bottom:10px;">  


                        <p:panel  header="Lista Apoios Cadastrados" style="margin-bottom:2px;">  
                            
                            <h:panelGrid columns="2">
                                <p:selectOneMenu value="#{livroBean.apoioAdicionado.id}"  effect="fade"   >
                                    <f:selectItems value="#{apoioBean.listaApoios}" var="apoio"  itemLabel="#{apoio.nome}" itemValue ="#{apoio.id}"  />
                                </p:selectOneMenu>
                            </h:panelGrid>

                            <h:panelGrid columns="1">
                                <p:commandButton value="Adicionar Apoio! "  action="#{livroBean.addApoio()}" immediate="false" ajax="false"  />
                            </h:panelGrid>
                        
                        </p:panel>  
                        <p:separator /> 
                        <p:panel  header="Apoios adicionados a Obra" style="margin-bottom:2px;">  


                            <h:panelGrid columns="1" >

                                <p:dataTable value="#{livroBean.apoio}" var="a">
                                    <p:column headerText="ID">
                                        <h:outputText value="#{a.id}" />
                                    </p:column>

                                    <p:column headerText="Nome">
                                        <h:outputText value="#{a.nome}" />
                                    </p:column>

                                    <p:column headerText="Remover">
                                        <p:commandButton value="Remover" action="#{livroBean.removerApoio()}" immediate="true" ajax="false" />
                                    </p:column>

                                </p:dataTable>
                            </h:panelGrid>
                        </p:panel>  
                        <p:separator /> 

                        <h:panelGrid columns="3">
                            <p:commandButton value="Anterior "  action="/cadastros/obras/livros/editar/editarLivro3.xhtml" immediate="true" icon="ui-icon-seek-prev" ajax ="false" />
                            <p:commandButton value="Cancelar " action="/cadastros/obras/livros/listar/listarLivros.xhtml?faces-redirect=true"  actionListener="#{livroBean.novoLivro()}" immediate="true" ajax="false" />
                            <p:commandButton value="Próximo "  action="/cadastros/obras/livros/editar/editarLivro5.xhtml" actionListener="#{livroBean.buscarDadosObra()}" immediate="true" icon="ui-icon-seek-next" ajax="false" />

                        </h:panelGrid>

                    </p:panel>  





                </h:form>    
            </f:view>
        </ui:define>
    </ui:decorate>
</html>



